package com.liao.badminton.handler.encode;


import com.liao.badminton.code.util.ObjectSerialUtil;
import com.liao.badminton.dto.SystemUsersDto;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

public class TransferStandardEncode extends MessageToByteEncoder<SystemUsersDto> {
    @Override
    protected void encode(ChannelHandlerContext channelHandlerContext, SystemUsersDto transferStandard, ByteBuf byteBuf) throws Exception {
        byte[] marshal = ObjectSerialUtil.serializer(transferStandard);
        byteBuf.writeInt(marshal.length);
        byteBuf.writeBytes(marshal);
    }
}
